package com.tjw.ec.upms.api.feign.factory;

import com.tjw.ec.upms.api.feign.RemoteRoleService;
import com.tjw.ec.upms.api.feign.fallback.RemoteRoleServiceFallbackImpl;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


/**
 * 远程调用异常工厂 : 角色表,基本权限的集合。无上级与下级之分;
 *
 * @author T-junwen
 * @email t-junwen@foxmail.com
 * @date 2019-08-02 11:58:44
 */
@Slf4j
@Component
public class RemoteRoleServiceFallbackFactory implements FallbackFactory<RemoteRoleService> {

    @Override
    public RemoteRoleService create(Throwable throwable) {
        RemoteRoleServiceFallbackImpl remoteRoleServiceFallback = new RemoteRoleServiceFallbackImpl();
        remoteRoleServiceFallback.setCause(throwable);
        return remoteRoleServiceFallback;
    }
}

